package com.colt.ribbonConfig;

import com.colt.contentcenter.config.rule.NacosSameClusterWeightedRule;
import com.netflix.loadbalancer.IPing;
import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.PingUrl;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @program: content-center
 * @description: ribbon配置类,记住，此类放在启动类以外的包
 * @author: colt
 * @create: 2020-05-04 12:45
 **/
@Configuration
public class RibbonConfig {
    /*
    * 负载均衡的规则
    * */
    @Bean
    public IRule ribbonRule(){
        return new NacosSameClusterWeightedRule();
        //return new NacosWeightedRuleConfig();
        //return new RandomRule();
    }

    /*ping 的规则*/
    @Bean
    public IPing pingServer(){
        return new PingUrl();
    }

}
